package heima3_2.cn.osc.ui.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;

/**
 * Created by emily on 2017/1/14.
 */

public class ExecrciseFragmentAdapater extends FragmentPagerAdapter{
    private List<Fragment> mFragment;
    String[] mTitles = new String[]{"近期活动", "热门活动"};
  public void setFragmentList(List<Fragment> fragment ){
      mFragment=fragment;
  }

    public ExecrciseFragmentAdapater(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {
        if(mFragment!=null){
            return mFragment.get(position);
        }
        return null;
    }

    @Override
    public int getCount() {
        if(mFragment!=null){
            return mFragment.size();
        }
        return 0;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return mTitles[position];
    }
}
